import Vue from 'vue'
import Router from 'vue-router'
import store from '@/store/store'
import moldManagement from './moldManagement'
import planManage from './planManage'
import productManage from './productManage'
import dataBoard from './dataBoard'


Vue.use(Router);
import login from '../views/login/login.vue'
import layout from '../components/layout.vue'


const routes = [
    {
        path: '/',
        name: 'login',
        component: login
    },
    {
        path: '/defectiveRate',   //不良率
        name: 'defectiveRateLayout',
        component: layout,
        children: [
            {
                path: '/defectiveRate',
                name: 'defectiveRate',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/defectiveRate/defectiveRate.vue'),
            },
            {
                path: '/defectiveRate/deviceStatus',
                name: 'deviceStatus',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/defectiveRate/deviceStatus.vue'),
            },
            {
                path: '/defectiveRate/dataMiningDetails',   //数采详情
                name: 'dataMiningDetails',
                component: () => import('../views/defectiveRate/dataMiningDetails/index.vue')
            },
            {
                path: '/defectiveRate/alarmDetail',   //报警明细
                name: 'alarmDetail',
                component: () => import('../views/defectiveRate/alarmDetail.vue')
            },
        ]
    },
    //备品备件管理管理
    {
        path: '/spareParts',
        name: 'sparePartsLayout',
        component: layout,
        children: [
            //仓库配置
            {
                path: '/spareParts/dataAdministration/storehouse',
                name: 'storeHouse',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/storeHouse.vue'),
            },
            {
                path: '/spareParts/dataAdministration/detailsQuery',//仓库明细
                name: 'detailsQuery',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/detailsQuery.vue'),
            },
            {
                path: '/spareParts/dataAdministration/inventory',//线边仓盘点记录
                name: 'inventory',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/inventory.vue'),
            },
            {
                path: '/spareParts/dataAdministration/recyclable',//可回收
                name: 'recyclable',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/recyclable.vue'),
            },
            {
                path: '/spareParts/dataAdministration/exception',//异常定义
                name: 'exception',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/exception.vue'),
            },
            //货架配置
            {
                path: '/spareParts/dataAdministration/goodsShelves',
                name: 'goodsShelves',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/goodsShelves.vue'),
            },
            //库位配置
            {
                path: '/spareParts/dataAdministration/location',
                name: 'location',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/location.vue'),
            },
            //物料配置
            {
                path: '/spareParts/dataAdministration/material',
                name: 'material',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/dataAdministration/material.vue'),
            },
            //备品采购
            {
                path: '/spareParts/attachmentProcurement/procurement',
                name: 'procurement',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/attachmentProcurement/procurement.vue'),
            },
            //设备详情
            {
                path: '/spareParts/attachmentProcurement/detailPurchaseModal',
                name: 'detailProcurementModal',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/attachmentProcurement/modules/detailProcurementModal.vue'),
            },
            //备品台账
            {
                path: '/spareParts/attachmentAccount/account',
                name: 'account',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/attachmentAccount/account.vue'),
            },
            //备件盘点
            {
                path: '/spareParts/sparePartsCheck/list',
                name: 'sparePartsCheck',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/sparePartsCheck/list.vue'),
            },
            {
                path: '/spareParts/inventory/plan',
                name: 'inventoryplan',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/inventory/plan.vue'),
            },
            {
                path: '/spareParts/inventory/task',
                name: 'inventorytask',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/inventory/task.vue'),
            },
        ]
    },

    //文档管理
    {
        path: '/docManagement',
        name: 'docManagementLayout',
        component: layout,
        children: [
            {
                path: '/knowLedge',
                name: 'knowLedge',
                meta: {
                    title: store.state.title,
                },
                component: () => import('../views/knowledgeBase/index.vue'),
            },
            {
                path: '/docManagement/sparepartDoc',
                name: 'sparepartDoc',
                meta: {
                    title: store.state.title,
                },
                component: () => import('../views/docManagement/spart/index.vue'),
            },
            {
                path: '/docManagement/personal',
                name: 'docManagement-personal',
                meta: {
                    title: store.state.title,
                },
                component: () => import('../views/docManagement/personal/index.vue'),
            },
            {
                path: '/docManagement/other',
                name: 'docManagement-other',
                meta: {
                    title: store.state.title,
                },
                component: () => import('../views/docManagement/other/index.vue'),
            },
            // 维修知识库
            {
                path: '/docManagement/maintainKnowLedge',
                name: 'maintainKnowLedge',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/docManagement/maintainKnowLedge/index.vue'),
            },
            // 单点教育
            {
                path: '/docManagement/singleEdu',
                name: 'singleEdu',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/docManagement/singleEdu/index.vue'),
            }
        ]
    },


    //备件管理
    {
        path: '/spareParts',
        name: 'spareLayout',
        component: layout,
        children: [
            {
                path: '/spareParts/operations/premium',
                name: 'premium',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/premium/index.vue'),
            },
            {
                path: '/spareParts/operations/scrapapproval',
                name: 'scrapapproval',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/scrapapproval/index.vue'),
            },
            {
                path: '/spareParts/operations/statistical',
                name: 'statistical',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/statistical/index.vue'),
            },
            {
                path: '/spareParts/operations/premium/addScrapApply',
                name: 'addScrapApply',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/premium/components/addScrapApply.vue'),
            },
            {
                path: '/spareParts/operations/recipientsrevert',
                name: 'recipientsrevert',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/recipientsrevert/index.vue'),
            },
            {
                path: '/spareParts/operations/outboundrecords',
                name: 'outboundrecords',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/outboundrecords/index.vue'),
            },
            {
                path: '/spareParts/operations/recipientsapply',
                name: 'recipientsapply',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/recipientsapply/index.vue'),
            },
            {
                path: '/spareParts/operations/recipientsapproval',
                name: 'recipientsapproval',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/recipientsapproval/index.vue'),
            },
            {
                path: '/spareParts/operations/addrecipientsapply',
                name: 'recipientsModule',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/modules/recipientsModule.vue'),
            },
            {
                path: '/spareParts/operations/approvalModule',
                name: 'approvalModule',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/modules/approvalModule.vue'),
            },
            {
                path: '/spareParts/operations/scrapapprovalModule',
                name: 'scrapapprovalModule',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/modules/scrapapprovalModule.vue'),
            },
            {
                path: '/spareParts/operations/addrecipientsrevert',
                name: 'recipientsrevertModule',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/spareParts/operations/modules/recipientsrevertModule.vue'),
            }

        ]
    },
    // 系统管理
    {
        path: '/userManage',
        name: 'userLayout',
        component: layout,
        children: [
            //部门管理
            {
                path: '/department',
                name: 'department ',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/department/index.vue'),
            },
            {
                path: '/userManage',
                name: 'userManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/userManage/index.vue'),
            },
            {
                path: '/processRoute',
                name: 'processRoute',
                component: () => import('../views/sysSet/processRoute/index.vue')
            },

            {
                path: '/bom',
                name: 'bom',
                component: () => import('../views/sysSet/bom/index.vue')
            },
            {
                path: '/roleManage',
                name: 'roleManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/roleManage/index.vue'),
            },
            {
                path: '/logPush',
                name: 'logPush',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/logPush/index.vue'),
            },
            {
                path: '/systemNotice',
                name: 'systemNotice',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/systemNotice/index.vue'),
            },
            {
                path: '/trademark',
                name: 'trademark',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/trademark/index.vue'),
            },
            {
                path: '/logGet',
                name: 'logGet',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/logGet/index.vue'),
            },
            {
                path: '/organization',
                name: 'organization',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/department/treeDepartment.vue'),
            },
            {
                path: '/menuManage',
                name: 'menuManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/menuManage/index.vue'),
            },
            {
                path: '/hierarchyManage',
                name: 'hierarchyManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/hierarchyManage/index.vue'),
            },
            {
                path: '/companyManage',
                name: 'companyManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/companyManage/index.vue'),
            },
            {
                path: '/fieldManage',
                name: 'fieldManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/fieldManage/index.vue'),
            },
            {
                path: '/dataDictionary',
                name: 'dataDictionary',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/dataDictionary/index.vue'),
            },
            {
                path: '/classManage',
                name: 'classManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/classManage/index.vue'),
            },
            {
                path: '/andonCall',
                name: 'andonCall',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/andonCall/index.vue'),
            },
            {
                path: '/productionShift',
                name: 'productionShift',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/production-input/production-shift/index.vue'),
            },
            {
                path: '/workTeam',
                name: 'workTeam',
                component: () => import('../views/sysSet/production-input/workTeam/index.vue')
            },
            {
                path: '/productionInterval',
                name: 'productionInterval',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/production-input/production-interval/index.vue'),
            },
            {
                path: '/productionSchedule',
                name: 'productionSchedule',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/production-input/production-schedule/index.vue'),
            },
            {
                path: '/productionScheduleDetail',
                name: 'productionScheduleDetail',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/production-input/production-schedule-detail/index.vue'),
            },
            {
                path: '/screenManagement',
                name: 'screenManagement',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/screenManagement/index.vue'),
            },
            {
                path: '/organizationParam',
                name: 'organizationParam',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/organizationParam/index.vue'),
            },
            {
                path: '/billWithManagement',
                name: 'billWithManagement',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/billWithManagement/index.vue'),
            },
            {
                path: '/equipImage',
                name: 'equipImage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/equipImage/index.vue'),
            },
            {//设备与人员关联
                path: '/equipmentAssociation',
                name: 'equipmentAssociation',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/equipmentAssociation/index.vue'),
            },
            {//设备与人员关联动作
                path: '/equipmentAssociation/associationUser',
                name: 'associationUser',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/equipmentAssociation/associationUser.vue'),
            },
            {//清线
                path: '/lineClean',
                name: 'lineClean',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/lineClean/index.vue'),
            },
            {//清线查看
                path: '/lineClean/detail',
                name: 'lineCleanDetail',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/lineClean/detail.vue'),
            },
            {
                path: '/staffSkills',
                name: 'staffSkills',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/staffSkills/index.vue'),
            },
            {
                path: '/dictionaries',
                name: 'dictionaries',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/dictionaries/index.vue'),
            },
            {
                path: '/reasonClosure',
                name: 'reasonClosure',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/reasonClosure/index.vue'),
            },
            {
                path: '/basicMaterialValues',
                name: 'basicMaterialValues',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/basicMaterialValues/index.vue'),
            },
            {
                path: '/materialMoldCode',
                name: 'materialMoldCode',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/materialMoldCode/index.vue'),
            },
            {
                path: '/marketingBalance',
                name: 'marketingBalance',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/marketingBalance/index.vue'),
            },
            {
                path: '/materialThreshold',
                name: 'materialThreshold',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/materialThreshold/index.vue'),
            },
            {
                path: '/padManage',
                name: 'padManage',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/padManage/index.vue'),
            },
            //现场仓调拨记录
            {
                path: '/transferRecord',
                name: 'transferRecord',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/sysSet/transferRecord/index.vue'),
            },
        ]
    },

    //设备基础
    {
        path: '/devBasic',
        name: 'cutterLayout',
        component: layout,
        children: [
            {
                path: '/devBasic/earlierStage/purchase',
                name: 'purchase',
                meta: {
                    title: store.state.title,
                    keepAlive: false
                },
                component: () => import('../views/devBasic/earlierStage/purchase.vue'),
            },
            {
                path: '/devBasic/earlierStage/acceptanceCheck',
                name: 'acceptanceCheck',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/acceptanceCheck.vue'),
            },
            {
                path: '/devBasic/earlierStage/detailAcceptanceCheckModal',
                name: 'acceptanceCheck',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/detailAcceptanceCheckModal.vue'),
            },
            {
                path: '/devBasic/earlierStage/acceptanceCheckInput',
                name: 'acceptanceCheck',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/addAcceptanceCheckModal.vue'),
            },
            {
                path: '/devBasic/earlierStage/pdebugging',
                name: 'pdebugging',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/pdebugging.vue'),
            },
            {
                path: '/devBasic/earlierStage/pdebuggingInput',
                name: 'pdebugging',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/addPdebuggingModal.vue'),
            },
            {
                path: '/devBasic/earlierStage/pdebugging/detailPdebuggingModal',
                name: 'pdebugging',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/detailPdebuggingModal.vue'),
            },
            {
                path: '/devBasic/earlierStage/checkAndAccept',
                name: 'checkAndAccept',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/checkAndAccept.vue'),
            },
            {
                path: '/devBasic/earlierStage/checkAndAccept/detailCheckModal',
                name: 'checkAndAccept',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/detailCheckModal.vue'),
            },
            {
                path: '/devBasic/earlierStage/checkAndAcceptContent',
                name: 'checkAndAccept',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/addCheckModal.vue'),
            },
            {
                path: '/devBasic/earlierStage/addAcceptanceCheckModal',
                name: 'addAcceptanceCheckModal',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/addAcceptanceCheckModal.vue'),
            },
            {
                path: '/devBasic/earlierStage/detailPurchaseModal',
                name: 'detailPurchaseModal',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/earlierStage/modules/detailPurchaseModal.vue'),
            },
            {
                path: '/devBasic/equipmentsLedgerManagement/equipmentsLedger',
                name: 'equipmentsLedger',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipmentsLedgerManagement/equipmentsLedger.vue'),
            },
            //报废申请
            {
                path: '/devBasic/equipmentscrapped/scrapapplication',
                name: 'scrapapplication',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipmentscrapped/Scrapapplication/index.vue'),
            },
            //报废申请详情
            {
                path: '/devBasic/equipmentscrapped/scrapapplicationDetail',
                name: 'scrapapplicationDetail',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipmentscrapped/Scrapapplication/detail.vue'),
            },
            //报废审批
            {
                path: '/devBasic/equipmentscrapped/scrapapproval',
                name: 'scrapapproval',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipmentscrapped/Scrapapproval/index.vue'),
            },
            {
                path: '/devBasic/equipmentsLedgerManagement/equipmentsStocktaking',
                name: 'equipmentsStocktaking',
                meta: {
                    title: store.state.title,
                },
                component: () => import('../views/devBasic/equipmentsLedgerManagement/equipmentsStocktaking.vue'),
            },
            {
                path: '/devBasic/equipmentsLedgerManagement/equipmentScore',
                name: 'equipmentScore',
                meta: {
                    title: store.state.title,
                },
                component: () => import('../views/devBasic/equipmentsLedgerManagement/modules/equipmentScore.vue'),
            },
            {
                path: '/devBasic/equipmentsLedgerManagement/ledgerDetailModal',
                name: 'ledgerDetailModal',
                meta: {
                    title: store.state.title,
                },
                component: () => import('../views/devBasic/equipmentsLedgerManagement/modules/ledgerDetailModal.vue'),
            },
            {
                path: '/devBasic/equipmentsChangesManagement/equipmentsChangesList/:tagName',
                name: 'equipmentsChangesList',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipmentsChangesManagement/equipmentsChangesList.vue'),
            },
            {
                path: '/devBasic/equipmentsChangesManagement/addAndDetail',
                name: 'equipmentsChangesList',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipmentsChangesManagement/modules/AddChangesModal.vue'),
            },
            //异动统计
            {
                path: '/devBasic/equipmentsChangesManagement/alienStatistics',
                name: 'alienStatistics',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipmentsChangesManagement/alienStatistics.vue'),
            },
            {
                path: '/devBasic/basicData/deviceType',
                name: 'deviceType',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/basicData/deviceType.vue'),
            },
            {
                path: '/devBasic/basicData/centerUser',
                name: 'centerUser',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/basicData/centerUser.vue'),
            },
            //设备折旧
            {
                path: '/devBasic/basicData/deviceDepreciation',
                name: 'deviceDepreciation',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/basicData/deviceDepreciation.vue'),
            },
            //评分表配置
            {
                path: '/devBasic/basicData/scoringConfiguration',
                name: 'scoringConfiguration',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/basicData/score-config/index.vue'),
            },
            //设备盘点
            {
                path: '/devBasic/equipCheck/list',
                name: 'equipCheck',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/equipCheck/list.vue'),
            },
            //capex
            {
                path: '/devBasic/capex',
                name: 'capex',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/capex/index.vue'),
            },
            {
                path: '/devBasic/capexHome',
                name: 'capex',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/capex/Home.vue'),
            },
            {
                path: '/devBasic/capexList',
                name: 'capex',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/capex/list.vue'),
            },
            //capex
            {
                path: '/devBasic/capexOperation',
                name: 'capexOperation',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devBasic/capex/operation.vue'),
            }
        ]
    },
    //设备现场
    {
        path: '/devScene',
        name: 'devSceneLayout',
        component: layout,
        children: [
            {
                path: '/addspare',
                name: 'addspare',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintenanceDetails/addSpare/addspare.vue')
            },
            {
                path: '/editspare',
                name: 'editspareinfo',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintenanceDetails/addSpare/components/editspareinfo.vue')
            },
            {
                path: '/detailinfo',
                name: 'detailinfo',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintenanceDetails/addDetails/detailinfo.vue')
            },
            {
                path: '/checkusetools',
                name: 'usetools',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintenanceDetails/components/usetools.vue')
            },
            {
                path: '/maintenanceDetail',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintenanceDetails/detatil.vue'),
            },
            {
                path: '/ApprovalProcessdetail',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/ApprovalProcessdetail/index.vue'),
            },
            {
                path: '/ApprovalProcess',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/ApprovalProcess/index.vue'),
            },
            {
                path: '/MaintenanceCalendar',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/MaintenanceCalendar/index.vue'),
            },
            {
                path: '/maintenanceList',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/devorder/index.vue'),
            },
            {
                path: '/devScene/maintain/project',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintain/project.vue'),
            },
            {
                path: '/devScene/maintain/plancard',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintain/plancard.vue'),
            },
            {
                path: '/devScene/maintain/rule',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintain/rule.vue'),
            },
            {
                path: '/devScene/maintain/plan',
                name: 'plan',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintain/plan.vue'),
            },
            {
                path: '/devScene/maintain/management',
                name: 'management',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintain/management.vue'),
            },
            {
                path: '/devScene/maintain/yieldRate',
                name: 'yieldRate',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/maintain/yieldRate.vue'),
            },
            // 设备点检
            {
                path: '/devScene/deviceSpotCheck/hall',
                name: 'hall',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/hall/index.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/project',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/project.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/plancard',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/plancard.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/rule',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/rule.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/plan',
                name: 'plan',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/plan.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/management',
                name: 'management',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/management.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/management/detail',
                name: 'deviceScmanagementDetail',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/management/checkDetail.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/yieldRate',
                name: 'yieldRate',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/yieldRate.vue'),
            },

            {
                path: '/devScene/deviceSpotCheck/project',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/project.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/plancard',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/plancard.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/rule',
                name: 'project',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/rule.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/plan',
                name: 'devicePlan',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/plan.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/management',
                name: 'deviceManagement',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/management.vue'),
            },
            {
                path: '/devScene/deviceSpotCheck/yieldRate',
                name: 'deviceYieldRate',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/deviceSpotCheck/yieldRate.vue'),
            },
            // -----------------------
            // {
            //     path: '/devScene/spotCheck/checkProject',
            //     name: 'checkProject',
            //     meta: {
            //         title: store.state.title
            //     },
            //     component: () => import('../views/devScene/spotCheck/checkProject'),
            // },
            // {
            //     path: '/devScene/spotCheck/checkPlan',
            //     name: 'checkPlan',
            //     meta: {
            //         title: store.state.title
            //     },
            //     component: () => import('../views/devScene/spotCheck/checkPlan'),
            // },
            // {
            //     path: '/devScene/spotCheck/checkTask',
            //     name: 'checkTask',
            //     meta: {
            //         title: store.state.title
            //     },
            //     component: () => import('../views/devScene/spotCheck/checkTask'),
            // },
            // {
            //     path: '/devScene/spotCheck/checkAchievementRate',
            //     name: 'checkAchievementRate',
            //     meta: {
            //         title: store.state.title
            //     },
            //     component: () => import('../views/devScene/spotCheck/checkAchievementRate'),
            // },
            {
                path: '/devScene/accuracy/accuracyProject',
                name: 'accuracyProject',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/accuracy/accuracyProject'),
            },
            {
                path: '/devScene/accuracy/accuracyPlan',
                name: 'accuracyPlan',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/accuracy/accuracyPlan'),
            },
            {
                path: '/devScene/accuracy/accuracyTask',
                name: 'accuracyTask',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/accuracy/accuracyTask'),
            },
            {
                path: '/devScene/accuracy/accuracyRecord',
                name: 'accuracyRecord',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/accuracy/accuracyRecord'),
            },
            {
                path: '/devScene/repair/orderList',
                name: 'orderList',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/repair/orderList.vue'),
            },
            {
                path: '/devScene/repair/statement',
                name: 'statement',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/repair/statement.vue'),
            },
            {
                path: '/devScene/repair/willBuyList',
                name: 'willBuyList',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/repair/willBuyList.vue'),
            },
            {
                path: '/devScene/configuration/malfunction',
                name: 'malfunction',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/configuration/malfunction.vue'),
            },
            {
                path: '/devScene/configuration/processMode',
                name: 'processMode',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/configuration/processMode.vue'),
            },
            {
                path: '/devScene/configuration/personnelManagement',
                name: 'personnelManagement',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/configuration/personnelManagement.vue'),
            },
            {
                path: '/devScene/configuration/toolMaintenance',
                name: 'toolMaintenance',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/configuration/toolMaintenance.vue'),
            },
            {
                path: '/devScene/configuration/specialRootList',
                name: 'specialRootList',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/configuration/specialRootList.vue'),
            },
            {
                path: '/devScene/configuration/deviceList',
                name: 'deviceList',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/configuration/deviceList.vue'),
            },
            {
                path: '/devScene/configuration/materialList',
                name: 'materialList',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/configuration/materialList.vue'),
            },
            {
                path: '/devScene/statisticsAnalysis',
                name: 'statisticsAnalysis',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/devScene/statisticsAnalysis/index.vue'),
            },
        ]
    },
    // 设备故障响应
    {
        path: '/fault',
        name: 'faultLayout',
        component: layout,
        children: [
            // 基础配置--故障分类
            {
                path: '/fault/basicConfig/faultClassify',
                name: 'faultClassify',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/basicConfig/faultClassify.vue'),
            },
            // 基础配置--故障分类
            {
                path: '/fault/basicConfig/faultType',
                name: 'faultType',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/basicConfig/faultType.vue'),
            },
            // 基础配置--升级机制
            {
                path: '/fault/basicConfig/upgrade',
                name: 'upgrade',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/basicConfig/upgrade.vue'),
            },
            // 接单大厅
            {
                path: '/fault/workOrderHall',
                name: 'workOrderHall',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/workOrderHall/index.vue'),
            },
            // 设备维修提醒配置
            {
                path: '/fault/deviceRepairRule',
                name: 'deviceRepairRule ',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/workOrderHall/deviceRepairRule/index.vue'),
            },
            // andon
            {
                path: '/fault/andon',
                name: 'andon',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/andon/index.vue'),
            },
            // andon
            {
                path: '/fault/andonDetail',
                name: 'andonDetail',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/andon/detail.vue'),
            },
            // 工单报表
            {
                path: '/fault/statement/workOrder',
                name: 'workOrder',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/workOrder.vue'),
            },
            {
                path: '/fault/statement/workCard',
                name: 'workOrder',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/workCard/index.vue'),
            },
            // 工单报表详情
            {
                path: '/fault/statement/workOrderDetail',
                name: 'workOrder',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/workOrderHall/orderDetailModal.vue'),
            },
            // 设备维修报表
            {
                path: '/fault/statement/equipmentMaintenance',
                name: 'equipmentMaintenance',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/equipmentMaintenance.vue'),
            },
            // 人员维修报表
            {
                path: '/fault/statement/person',
                name: 'person',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/person.vue'),
            },
            // 设备维修图表
            {
                path: '/fault/statement/equipmentEcharts',
                name: 'equipmentEcharts',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/equipmentEcharts.vue'),
            },
            // 人员维修图表
            {
                path: '/fault/statement/personEcharts',
                name: 'personEcharts',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/personEcharts.vue'),
            },
            {
                path: '/fault/statement/carrier',
                name: 'carrier',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/carrier.vue'),
            },
            {
                path: '/fault/statement/towing',
                name: 'towing',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/statement/towing.vue'),
            },
            {
                path: '/fault/equipMaintenanceReport',
                name: 'equipMaintenanceReport',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/fault/equipMaintenanceReport/index.vue'),
            },
        ]
    },
    {
        path: '/productManage',
        component: layout,
        children: [
            {
                path: '/productManage/deviceOEE',
                name: 'deviceOEE',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/productManage/deviceOEE.vue'),
            },
            {
                path: '/productManage/oeelose',
                name: 'oeelose',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/productManage/oeelose.vue'),
            },
            {
                path: '/productManage/deviceTrend',
                name: 'oeeTrend',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/productManage/oeeTrend.vue'),
            },
        ]
    },
    // {
    //     path: '/andon',
    //     component: layout,
    //     children: [
    //       {
    //         path: '/andon/binding',
    //         name: 'binding',
    //         meta: {
    //           title: store.state.title
    //         },
    //         component: () => import('../views/andon/binding/index.vue'),
    //       },
    //       {
    //         path: '/andon/pushRule',
    //         name: 'pushRule',
    //         meta: {
    //           title: store.state.title
    //         },
    //         component: () => import('../views/andon/pushRule/index.vue'),
    //       },
    //       {
    //         path: '/andon/reasonCode',
    //         name: 'reasonCode',
    //         meta: {
    //           title: store.state.title
    //         },
    //         component: () => import('../views/andon/reasonCode/index.vue'),
    //       },
    //       {
    //         path: '/andon/pushRecord',
    //         name: 'pushRecord',
    //         meta: {
    //           title: store.state.title
    //         },
    //         component: () => import('../views/andon/pushRecord/index.vue'),
    //       },
    //       {
    //         path: '/andon/statisticsList',
    //         name: 'statisticsList',
    //         meta: {
    //           title: store.state.title
    //         },
    //         component: () => import('../views/andon/statistics/statisticsList.vue'),
    //       },
    //       {
    //         path: '/andon/statisticsChart',
    //         name: 'statisticsChart',
    //         meta: {
    //           title: store.state.title
    //         },
    //         component: () => import('../views/andon/statistics/statisticsChart.vue'),
    //       },
    //     ]
    // },
    {
        path: '/qualityManage',
        component: layout,
        children: [
            {
                path: '/qualityManage/badInput',
                name: 'badInput',
                meta: {
                    title: store.state.title
                },
                component: () => import('../views/qualityManage/badInput.vue'),
            },
        ]
    },
    // {
    //     path: '/performance',
    //     name: 'performance',
    //     component: () => import('@/bigScreen/performance.vue')
    // },
    // {
    //     path: '/motorFactory',
    //     name: 'motorFactory',
    //     component: () => import('@/bigScreen/motorFactory.vue')
    // },
    // {
    //     path: '/motorFactoryList',
    //     name: 'motorFactoryList',
    //     component: () => import('@/bigScreen/motorFactoryList.vue')
    // },
    // {
    //     path: '/test',
    //     name: 'test',
    //     component: () => import('@/bigScreen/test.vue')
    // },
    // {
    //     path: '/andonScreen',
    //     name: 'andonScreen',
    //     component: () => import('@/bigScreen/andonScreen.vue')
    // },
    // {
    //     path: '/capExScreen',
    //     name: 'capExScreen',
    //     component: () => import('@/bigScreen/capExScreen.vue')
    // },
    // {
    //     path: '/collectScreen',
    //     name: 'collectScreen',
    //     component: () => import('@/bigScreen/collectScreen.vue')
    // },
    // {
    //     path: '/devOverview',
    //     name: 'devOverview',
    //     component: () => import('@/bigScreen/devOverview.vue')
    // },
    // {
    //     path: '/realTimeStatus',
    //     name: 'realTimeStatus',
    //     component: () => import('@/bigScreen/realTimeStatus.vue')
    // },
    // {
    //     path: '/assemblyMonitoring',
    //     name: 'assemblyMonitoring',
    //     component: () => import('@/bigScreen/assemblyMonitoring.vue')
    // },
    // {
    //     path: '/chooseBoard',
    //     name: 'chooseBoard',
    //     component: () => import('@/bigScreen/chooseBoard.vue')
    // },
    // {
    //     path: '/EOrderQ',
    //     name: 'EOrderQ',
    //     component: () => import('@/bigScreen/components/EOrderQ.vue')
    // },
    // {
    //     path: '/chooseBoard-copy',
    //     name: 'chooseBoard-copy',
    //     component: () => import('@/bigScreen/chooseBoard-copy.vue')
    // },
    //capex-print cat
    {
        path: '/catPrint',
        name: 'catPrint',
        meta: {
            title: store.state.title
        },
        component: () => import('../views/devBasic/capex/print/cat.vue'),
    },
    {
        path: '/satPrint',
        name: 'satPrint',
        meta: {
            title: store.state.title
        },
        component: () => import('../views/devBasic/capex/print/sat.vue'),
    },
    {
        path: '/fatPrint',
        name: 'fatPrint',
        meta: {
            title: store.state.title
        },
        component: () => import('../views/devBasic/capex/print/fat.vue'),
    },
    {
        path: '/capital',
        name: 'capital',
        meta: {
            title: store.state.title
        },
        component: () => import('../views/devBasic/capex/print/capital.vue'),
    },
    {
        path: '/downPayment',
        name: 'downPayment',
        meta: {
            title: store.state.title
        },
        component: () => import('../views/devBasic/capex/print/downPayment.vue'),
    },
    {
        path: '/fixedAssetPrint',
        name: 'fixedAssetPrint',
        meta: {
            title: store.state.title
        },
        component: () => import('../views/devBasic/capex/print/fixedAssetPrint.vue'),
    },
    //模具台账管理
    ...moldManagement,
    //计划管理
    ...planManage,
    // 生产管理
    ...productManage,
    // 统计报表
    ...dataBoard,
    // 404 页面
    {
        path: '*',
        name: 'notFound',
        meta: {
            isNotFound: true,
            title: ''
        },
        component: () => import('../components/notFound.vue')
    },
];
const isTong = process.env.NODE_ENV === 'tong';
let ksiot = '/kakone';
if (isTong) {
    ksiot = ''
}
const router = new Router({
    mode: 'history',
    base: `${ksiot}/tpm/`,
    routes,
    scrollBehavior() {
        return new Promise((resolve) => {
            setTimeout(() => {
                resolve({
                    x: 0,
                    y: 0
                })
            }, 500)
        })
    }
});

const whiteList = ['/']
const blackList = ['/andonScreen', '/chooseBoard', '/motorFactory', '/devOverview', '/collectScreen', '/capExScreen', '/motorFactoryList']
// 访问统计
let data_id = ''
router.beforeEach((to, from, next) => { //路由进入前触发
    // let fromPath = from.path == '/' ? to.path : from.path //刷新后form.path位'/'
    data_id = window.localStorage.getItem('DATE_ID') ? window.localStorage.getItem('DATE_ID') : Date.now()
    // next()
    const flag = blackList.some(val => val === to.path)
    if (flag) {
        next()
        return
    }
    if (localStorage.getItem("ziyunFactoryPortalToken")) {
        if (to.path === '/') {
            next()
        } else {
            if (localStorage.getItem('ziyunFactoryUserRoleName')) {
                next()
            } else {
                try {
                    next({...to, replace: true})
                } catch (error) {
                    localStorage.removeItem('ziyunFactoryPortalToken');
                    if (JSON.stringify(to.query) !== '{}') {
                        next({
                            path: '/',
                            query: {redirect: to.fullPath}
                        })
                    } else {
                        next(`/?redirect=${to.path}`)
                    }
                }
            }
        }
    } else {
        if (whiteList.indexOf(to.path) !== -1) {
            next()
        } else {
            if (JSON.stringify(to.query) !== '{}') {
                next({
                    path: '/',
                    query: {redirect: to.fullPath}
                })
            } else {
                next(`/?redirect=${to.path}`)
            }
        }
    }
});


router.afterEach((to, from) => {
    window.localStorage.setItem('DATE_ID', new Date().getTime())
    data_id = window.localStorage.getItem('DATE_ID');
    Vue.nextTick(function () {
        let title = store.state.title
        let path = {
            href: window.location.href,
            pathname: to.path,
            dateTime: data_id,
            title: to.meta.titleShow == true ? to.meta.title : title,
        }
        window.localStorage.setItem('PATH_INFO', JSON.stringify(path))
    })
    if (to.path === '/chooseBoard' && from.path !== '/') {
        window.localStorage.removeItem('tpmJumpUrl')
    }
});

/*router.beforeEach((to,from, next) => { //路由进入后触发
    if(to.path === '/chooseBoard' && from.path !== '/'){
        window.localStorage.removeItem('tpmJumpUrl')
    }
    next();
})*/


export default router
